﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Web;

namespace sdamarketing.App_Code
{
    public class Post
    {
        public void addStatus(string status,int user)
        {
            SqlConnection connection = ConnectionMenager.GetConnection();
            SqlParameter statusParam = new SqlParameter("@statusParam", status);
            SqlParameter userParam = new SqlParameter("@userParam", user);

            String sql = "INSERT INTO Postovi (Status,idUser) VALUES (@statusParam,@userParam)";

            SqlCommand command = new SqlCommand(sql, connection);
            command.Parameters.Add(statusParam);
            command.Parameters.Add(userParam);

            command.ExecuteNonQuery();
            connection.Close();
        }
        public void addStatus(string status, int user, string videoURL, string VideoOpis)
        {
            SqlConnection connection = ConnectionMenager.GetConnection();

            SqlParameter videoURLParam = new SqlParameter("@videoURLParam",videoURL);
            SqlParameter VideoOpisParam = new SqlParameter("@VideoOpisParam", VideoOpis);
            SqlParameter statusParam = new SqlParameter("@statusParam", status);
            SqlParameter userParam = new SqlParameter("@userParam", user);

            String sql = @"INSERT INTO Postovi (Status,idUser,VideoURL,VideoOpis) VALUES (@statusParam,@userParam,@videoURLParam,@VideoOpisPAram)";

            SqlCommand command = new SqlCommand(sql, connection);
            command.Parameters.Add(videoURLParam);
            command.Parameters.Add(VideoOpisParam);
            command.Parameters.Add(statusParam);
            command.Parameters.Add(userParam);

            command.ExecuteNonQuery();
            connection.Close();
        }
    }
}